<template>
  <div class="base_view_template">
    <component
      :is="component"
      :tasksConfig="tasksConfig"
      :layer="tasksConfig.children[0]"
      :nodeId="nodeId"
      v-if="tasksConfig && tasksConfig.children"
    ></component>
  </div>
</template>
<script>
export default {
  name: "BaseViewTemplate",
  props: {
    nodeId: {
      type: String,
      default() {
        return "Home";
      },
    },
  },
  data() {
    return {
      tasksConfig: {},
      component: "",
    };
  },
  async created() {
    const res = await this.$store.dispatch("getTasksConfigData", {
      nodeId: this.$props.nodeId,
    });
    this.tasksConfig = { ...res };
    this.getStructureBaseTemplate();
  },
  methods: {
    getStructureBaseTemplate() {
      const component = this.tasksConfig.children[0].component;
      this.component = () => import("./template/" + component);
    },
  },
};
</script>
<style lang="less"></style>
